﻿
@{ 
    var System = Developer.Service.SystemService.GetAll();
    var Info = System.OrderByDescending(a => a.LoginTime).FirstOrDefault();
    var books = Developer.Service.BookService.GetAll();
    var comments = Developer.Service.CommentService.GetAll();
    var users = Developer.Service.UserService.GetAll();
    var orders = Developer.Service.OrderService.GetAll();
    var reviews = Developer.Service.ReviewService.GetAll();
}
    <div class="page-container">
        <p class="f-20 text-success">欢迎使用 图书管理  <span class="f-14">v1.0</span>系统！</p>
        <p>登录次数： @System.Count()</p>
        <p>上次登录IP：@(Info.IPAddress)  上次登录时间：@(Info.LoginTime)</p>
        <table class="table table-border table-bordered table-bg">
            <thead>
                <tr>
                    <th colspan="7" scope="col">信息统计</th>
                </tr>
                <tr class="text-c">
                    <th>统计</th>
                    <th>图书库</th>
                    <th>用户</th>
                    <th>书评</th>
                    <th>评论</th>
                    <th>预定</th>
                </tr>
            </thead>
            <tbody>
                <tr class="text-c">
                    <td>总数</td>
                    <td>@(books.Count())</td>
                    <td>@(users.Count())</td>
                    <td>@(reviews.Count())</td>
                    <td>@(comments.Count())</td>
                    <td>@(orders.Count())</td>
                </tr>
                <tr class="text-c">
                    <td>今日</td>
                    <td>@(books.Where(a=>a.CreateTime.Month == DateTime.Now.Month && a.CreateTime.Day == DateTime.Now.Day ).Count())</td>
                    <td>@(users.Where(a=>a.CreateTime.Month == DateTime.Now.Month && a.CreateTime.Day == DateTime.Now.Day).Count())</td>
                    <td>@(reviews.Where(a=>a.CreateTime.Value.Month == DateTime.Now.Month && a.CreateTime.Value.Day == DateTime.Now.Day).Count())</td>
                    <td>@(comments.Where(a=>a.CreateTime.Month == DateTime.Now.Month && a.CreateTime.Day == DateTime.Now.Day).Count())</td>
                    <td>@(orders.Where(a=>a.CreateTIme.Month == DateTime.Now.Month && a.CreateTIme.Day == DateTime.Now.Day).Count())</td>
                </tr>
                <tr class="text-c">
                    <td>昨日</td>
                    <td>@(books.Where(a=>a.CreateTime.Month == DateTime.Now.Month && a.CreateTime.Day == DateTime.Now.Day-1).Count())</td>
                    <td>@(users.Where(a=>a.CreateTime.Month == DateTime.Now.Month && a.CreateTime.Day == DateTime.Now.Day - 1).Count())</td>
                    <td>@(reviews.Where(a => a.CreateTime.Value.Month == DateTime.Now.Month && a.CreateTime.Value.Day  == DateTime.Now.Day - 1 ).Count())</td>
                    <td>@(comments.Where(a=>a.CreateTime.Month == DateTime.Now.Month && a.CreateTime.Day == DateTime.Now.Day - 1).Count())</td>
                    <td>@(orders.Where(a=>a.CreateTIme.Month == DateTime.Now.Month && a.CreateTIme.Day == DateTime.Now.Day - 1).Count())</td>
                </tr>
               
                <tr class="text-c">
                    <td>本月</td>
                    <td>@(books.Where(a=>a.CreateTime.Month == DateTime.Now.Month).Count())</td>
                    <td>@(users.Where(a => a.CreateTime.Month == DateTime.Now.Month).Count())</td>
                    <td>@(reviews.Where(a => a.CreateTime.Value.Month == DateTime.Now.Month).Count())</td>
                    <td>@(comments.Where(a => a.CreateTime.Month == DateTime.Now.Month).Count())</td>
                    <td>@(orders.Where(a => a.CreateTIme.Month == DateTime.Now.Month).Count())</td>
                </tr>
            </tbody>
        </table>
        <table class="table table-border table-bordered table-bg mt-20">
            <thead>
                <tr>
                    <th colspan="2" scope="col">服务器信息</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <th width="30%">服务器计算机名</th>
                    <td><span id="lbServerName">@("http://" + Request.Url.Host)</span></td>
                </tr>
                <tr>
                    <td>服务器IP地址</td>
                    <td>@Request.ServerVariables.Get("Local_Addr").ToString();</td>
                </tr>
                <tr>
                    <td>服务器域名</td>
                    <td>@HttpContext.Current.Request.Url.Host</td>
                </tr>
                <tr>
                    <td>服务器端口 </td>
                    <td>@Request.ServerVariables.Get("Server_Port").ToString();</td>
                </tr>
                <tr>
                    <td>服务器IIS版本 </td>
                    <td>@Request.ServerVariables["SERVER_SOFTWARE"].ToString();</td>
                </tr>
                <tr>
                    <td>本文件所在文件夹 </td>
                    <td>@Request.PhysicalApplicationPath;</td>
                </tr>
                
            </tbody>
        </table>
    </div>
    
 
  